package br.com.ilhasoft.support.validation.validator;

import br.com.ilhasoft.support.validation.rule.DateRule;
import br.com.ilhasoft.support.validation.rule.Rule;
import br.com.ilhasoft.support.validation.util.ErrorMessageHelper;
import ohos.agp.components.Text;

public class DateValidator {
    /**
     * 日期验证
     * @param view
     * @param content
     * @param pattern
     * @param errorMessage
     * @param autoDismiss
     */
    public static void bindingDate(Text view, String content,String pattern,
        String errorMessage, boolean autoDismiss) {
        String handledErrorMessage = ErrorMessageHelper.getStringOrDefault(view,
                errorMessage, "Invalid data format");
        Rule rule = new DateRule(view, content , pattern, handledErrorMessage);
        rule.validate();
    }

}
